package Summative;

import javax.swing.*;
import java.awt.*;

public class TextPanel extends JPanel
{
  JTextField field;
  
  public TextPanel(VectorList vector, MenuItemList list)
  {
    super();
    setLayout(new BorderLayout());
    setPreferredSize(new Dimension(500, 20));
    
    list.setTextField(field);
    
    field = new JTextField();
    TextListener listen = new TextListener(field, vector);
    add(field, BorderLayout.CENTER);
    field.addActionListener(listen);
  }
  
  public void setTextForField(String text)
  {
    field.setText(text);
  }
}